<template>
  <div class="content3">
    <div class="Title">
      <p>部门动态</p>
    </div>
    <div class="text">
      <el-table :data="title" @row-click="article">
        <el-table-column prop="title">
          <template slot-scope="scope">
            <i class="arrow el-icon-arrow-right"></i>
            {{ scope.row.title }}
          </template>
        </el-table-column>
      </el-table>
    </div>
    <el-button
      type="primary"
      @click="godynamics"
      style="background-color: #084fb0; border-color: #084fb0"
      >查看更多
    </el-button>
  </div>
</template>
<script>
import { contentdynamics } from "@/api";
export default {
  name: "Dynamics",
  data() {
    return {
      title: [],
    };
  },
  //组件创建时发送API请求
  created() {
    contentdynamics().then((res) => {
      const data = res.data;
      this.title = data.slice(0, 5);
    });
  },
  methods: {
    godynamics() {
      this.$emit("dynamics", false);
      this.$router.push({
        path: "/more-text",
        query: { key: "部门动态", more: 3, article: 0, apinum: 2 },
      });
    },
    article(row, event, column) {
      this.$router.push({
        path: "/more-text",
        query: { key: "部门动态", more: 3, article: 3, id: row.id },
      });
    },
  },
};
</script>
<style>
/* 部门动态 */
.content3 {
  padding: 0.12rem;
  background: white;
  margin-bottom: 0.32rem;
}
/* 部门动态单行的子表格 */
.content3 .text .el-table .cell {
  line-height: 0.68rem !important;
  height: 0.68rem;
  width: 88%;
  margin-left: 0.6rem;
  font-size: 0.56rem;
  white-space: nowrap;
}
</style>
